/**
 * 
 */
package com.xb.demo5.singleton;

/**
 * @author kexue
 *
 */
public class SingleClass3 {

	private static SingleClass3 INSTANCE = null;
	
	private SingleClass3(){}
	/**
	 * 线程安全的懒汉
	 * @return
	 */
	public synchronized static SingleClass3 getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new SingleClass3();
		}
		return INSTANCE;
	}
	
	/**
	 * 线程安全的懒汉
	 * @return
	 */
	public  static SingleClass3 getInstance2() {
		synchronized(SingleClass3.class){
			if (INSTANCE == null) {
				INSTANCE = new SingleClass3();
				return INSTANCE;
			}
			return null;
		}
	
	}

}
